import { ElementClass } from "breeze-leaf-core-lib";
import { anyObject } from "../interface/state";


let __componentPropsProxy: anyObject = {};

type proxyFunction = (meta: ElementClass) => anyObject

export const registerComponentProps = (propProxy: { [componentName: string]: proxyFunction }) => {
  Object.assign(__componentPropsProxy, propProxy);
}

export const getComponentPropProxy = (componentName: string, meta: ElementClass) => {
  if (!__componentPropsProxy[componentName]) {
    return {};
  }
  return __componentPropsProxy[componentName](meta);
}